package com.wangzh.concurrent.lock;

import java.util.concurrent.CountDownLatch;
//计数器 减法
public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {
//        必须要执行的任务的时候
        CountDownLatch downLatch = new CountDownLatch(6);
        for (int i = 0; i < 6; i++) {
            new Thread(() ->{
                System.out.println(Thread.currentThread().getName()+"GO out");
                downLatch.countDown();
            },String.valueOf(i)).start();
        }

        downLatch.await();
        System.out.println("end");

    }
}
